package arg

import (
	"github.com/gurkankaymak/hocon"
	"db2s/ref"
)
func ruleStruct(hocon *hocon.Config, defaultRule, Str any) (err error) {
	var parameter = make(map[string]any)
	if parameter, err = getHoconConfigParameter(defaultRule, hocon); err != nil {
		return
	}
	if err = ref.MapToStruct(parameter, Str); err != nil {
		return
	}
	return
}
func structRuleArgParameter(hocon *hocon.Config) (Struct StructS, err error) {
	if err = ruleStruct(hocon, getStructRulesDefVal(), &Struct); err != nil {
		return
	}
	return
}
func syncRuleArgParameter(hocon *hocon.Config) (Sync SyncS, err error) {
	if err = ruleStruct(hocon, getSyncRulesDefVal(), &Sync); err != nil {
		return
	}
	return
}
func taskRuleArgParameter(hocon *hocon.Config) (Task TaskS, err error) {
	if err = ruleStruct(hocon, getTaskRulesDefVal(), &Task); err != nil {
		return
	}
	return
}
func logArgParameter(hocon *hocon.Config) (Log logDefVal, err error) {
	if err = ruleStruct(hocon, getLogDefVal(), &Log); err != nil {
		return
	}
	return
}
